"""
测试财务修改应收款数据并保存
"""
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By

#打开浏览器
driver = webdriver.Chrome()
driver.maximize_window()
driver.implicitly_wait(30)
#打开crm
driver.get("http://192.168.1.25/crm")
sleep(1)
#准备数据
username = "admin"
password = "123456"
ysk_name = "kezhang"
skje = "666"
#定位器
username_locator = (By.NAME,'name')
password_locator = (By.NAME,'password')
login_btn_locator = (By.NAME,'submit')
cw_locator = (By.LINK_TEXT,'财务')
xg_locator = (By.LINK_TEXT,'修改')
xg_yskm_locator = (By.NAME,'name')
xg_bc_btn_locator = (By.NAME,'submit')




#登录输入用户名和密码
driver.find_element(*username_locator).send_keys(username)
driver.find_element(*password_locator).send_keys(password)
sleep(1)
#点击登录
driver.find_element(*login_btn_locator).click()
sleep(1)
#点击财务
driver.find_element(*cw_locator).click()
sleep(1)
#点击修改
driver.find_element(*xg_locator).click()
#清除应收款名再次输入
driver.find_element(*xg_yskm_locator).clear()
driver.find_element(*xg_yskm_locator).send_keys(ysk_name)
sleep(2)
#点击保存
driver.find_element(*xg_bc_btn_locator).click()

#退出
sleep(2)
driver.quit()